package com.senlingspace.common.enums;

public enum SnapshotItemType {

    GOODS("GOODS", "商品"),
    TICKET("TICKET", "门票");

    private final String code;
    private final String description;

    SnapshotItemType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getDescription() {
        return description;
    }

    public String getCode() {
        return code;
    }

    public static SnapshotItemType fromCode(String code) {
        for (SnapshotItemType type : SnapshotItemType.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}
